
// 
// Created By: minanqiang 2021/05/26
// 
// Description: SimOneEnv

#pragma once
#include "../DefinesCore.hpp"
#include<string>
#include<vector>
CYBERTRON_BEGIN



class SimOneEnv
{
public:
	struct SimOneConfigCenterInfo
	{
		std::string ConfigCenterAddr;
		int ConfigCenterPort;
	};

	struct SimOneTaskRunnerPoolServerInfo
	{
		bool EnableSONServer;
		std::string SONServerAddr;
		int SONServerAddrPort;
		int SONHttpServerAddrPort;
	};

	struct SimOneCloudEnvInfo
	{
		std::string PodNodeName;
		std::string PodNodeIP;
		std::string PodName;
		std::string PodNameSpace;
		std::string PodIP;
		std::string PodServiceAccount;
		std::string ContainerName;
		
		bool PodSelfDeleted;
	};

	struct SimOneK8SDevOpsInfo
	{
		std::string K8SDevOpsAddr;
		std::string K8SDevOpsPort;
	};

	CybertronCoreAPI static SimOneEnv& GetInstance() {
		static SimOneEnv instance;
		return instance;
	}
	
	CybertronCoreAPI  bool Init();
	CybertronCoreAPI  bool IsCloudEnv();

	CybertronCoreAPI  std::string GetChannelValue();
	CybertronCoreAPI  std::string GetProductType();
	CybertronCoreAPI  std::string GetProductVersion();
	CybertronCoreAPI  std::string GetProductInfo();

	CybertronCoreAPI  bool GetConfigCenterInfo(SimOneConfigCenterInfo &ConfigCenterInfo);
	CybertronCoreAPI  bool GetCloundEnvInfo(SimOneCloudEnvInfo& CloundEnvInfo);
	CybertronCoreAPI  bool GetBaseWorkId(int& baseWorkId);
	CybertronCoreAPI  bool GetSimOneK8SDevOpsInfo(SimOneK8SDevOpsInfo& CloundServerInfo);
	CybertronCoreAPI  bool GetTaskRunnerPoolInfo(SimOneTaskRunnerPoolServerInfo& serverInfo);
	CybertronCoreAPI  bool hasPodTag(std::string tag);
	CybertronCoreAPI  int GetPodWorkNum();
	CybertronCoreAPI  std::string GetPodTagString();
	CybertronCoreAPI  bool GetWorkCapList(std::vector<std::string>& capList);
	
	~SimOneEnv();
protected:
	SimOneEnv();
protected:
	
	bool mIsCloudEnv;
	/*CONFIG_CENTER_ADDR
		CONFIG_CENTER_PORT*/

	int mConfigCenterPort;
	std::string mConfigCenterAddr;

	SimOneTaskRunnerPoolServerInfo mSimOneTaskRunnerPoolServerInfo;
	std::string mPodNodeName;
	std::string mPodNodeIP;
	std::string mPodName;
	std::string mContainerName;
	std::string mPodNameSpace;
	std::string mPodIP;
	std::string mPodServiceAccount;
	std::string mPodTagString;
	std::string mWorkCapString;
	std::string mK8SDevOpsAddr;
	std::string mK8SDevOpsPort;

	std::string mBaseWorkId;
	int mK8SPodWorkNum;
	bool mPodSelfDeleted;
	std::vector<std::string> mPodTagList;
	std::vector<std::string> mWorkCapList;

	bool mbInit;
};
CYBERTRON_END